Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: ABI Gen #3249

Open
wants to merge 164 commits into
base: ns/feat/abi-parser
Choose a base branch
from
Open

feat!: ABI Gen #3249

wants to merge 164 commits into from

Conversation

petertonysmith94
Copy link
Contributor

@petertonysmith94 petertonysmith94 commented Oct 4, 2024

Summary

This PR introduces AbiGen as a new way of typegen-ing. The implementation has two parts:

  1. AbiGen and its type generation which is done by using the AbiParser outputs,
  2. The CLI providing inputs to AbiGen and saving its outputs to disk

The next step would be to remove the abi-typegen package in a new PR.

Breaking Changes

Note

These will need to be combined into the final PR (#3085)

fuels typegen no longer accepts -s, -p and -c flags

pnpm fuels typegen can now automatically recognize the type of program it's building so the flags --script, --predicate and --contract and their shorthands have been removed.

The storageSlots static field has been moved from a typegen'd contract into its factory

Storage slots don't need to be on the typegen'd Contract because they are only used during contract deployment.

// before
import { MyContract } from './typegend/contracts'

const defaultStorageSlots = MyContract.storageSlots;

// now
import { MyContractFactory } from './typegend/contracts'

const defaultStorageSlots = MyContractFactory.storageSlots;

Typegen'd simple sway enums don't have the Input/Output suffix anymore

Given the following enum:

enum Color {
    Red: (),
    Green: (),
}

The outputted type looks like this:

// before
import { ColorInput, ColorOutput } from './typegend/contracts/MyContract';

// after
import { Color } from './typegend/contracts/MyContract';

Vec<T> has been removed in favor of T[] and cannot be imported anymore

// before
import { Vec } from './typegend/common';
type MyInputVector = Vec<number>;

// now
type MyInputVector = number[];

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@petertonysmith94 petertonysmith94 added the feat Issue is a feature label Oct 4, 2024
Copy link

vercel bot commented Oct 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 2, 2025 3:11pm
ts-api-docs ❌ Failed (Inspect) Jan 2, 2025 3:11pm
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 2, 2025 3:11pm
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 2, 2025 3:11pm

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Issue is a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants